const http = require('http')
const fs = require('fs')
const url= require('url')
const querystring = require('querystring')

const server = http.createServer((req,res)=>{
    //接收get数据
    let {pathname,query} = url.parse(req.url,true)
    //接收post数据
    let str = '';
        //接收到数据
    req.on('data',data=>{
        str += data
    })
        //接收结束
    req.on('end',()=>{
        console.log(querystring.parse(str))
        //开始返回数据
        res.write(str)
        //返回结束
        res.end()
    })
    
    
})
server.listen(8080)
